package com.niiwoo.activity.stage.enums.goods;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Created by dengyunhui on 2017/12/01.
 */
@AllArgsConstructor
@Getter
public enum GoodsPropertyDicEnum {

    MIAN_E(10000, "denomination", "面额", "prizeValue"),
    JI_FEN(10002, "integral", "积分", null),

    TOUZI_LILV(10003, "investRate", "投资利率", "investRate"),
    JIAXI_YUEFEN(10004, "numberMount", "加息月份/天数", "numberMount"),
    SHIYONG_LEIXING(10005, "suitProjectType", "适用标的类型", "suitProjectType"),
    SHIYONG_QIXIAN(10006, "suitProjectLimit", "适用标的期限", "suitProjectLimit"),
    SHIYONG_ZUIXIAO_JIN_E(10007, "minSuitProjectAmount", "适用金额最小值", "minSuitProjectAmount"),
    SHIYONG_ZUIDA_JIN_E(10008, "maxSuitProjectAmount", "适用金额最大值", "maxSuitProjectAmount"),
    DISCOUNT_RATE(10009, "discountRate", "折扣利率", "investRate"),
    DISCOUNT_PERIOD(10010, "discountPeriod", "折扣利率时长", "numberMount"),
    MAX_DISCOUNT_AMOUNT(10011, "maxDiscountAmount", "最大折扣金额,最大加息金额", "maxDiscountAmount"),
    MIN_SUIT_PROJECT_LIMIT(10013, "minSuitProjectLimit", "最小适用标的期限", "minSuitProjectLimit"),
    MAX_SUIT_PROJECT_LIMIT(10014, "maxSuitProjectLimit", "最大适用标的期限", "maxSuitProjectLimit"),

    EFFECTIVE_TYPE(10015, "effectiveType", "生效方式(0、时间段有效 1、顺延有效期)", null),
    
//    MAX_MONEY(10016,"maxMoney","上限金额","maxMoney"),
//    THRESHOLD_MONEY(10017,"thresholdMoney","使用金额门槛","thresholdMoney"),
    RATEINCREASE_TYPE(10018,"rateIncreaseType","加息时长类型(1表示月，2表示天)","rateIncreaseType"),
//    RATEINCREASE_DAY(10019,"rateIncreaseDay","加息天数","rateIncreaseDay"),

    // effectiveType=0 生效开始时间（yyyy-MM-dd）
    // effectiveType=1 延迟生效天数 单位是天数 只能是整数的(按配置当天计算X天后生效日期)
    EFFECTIVE_TYPE_VALUE1(10001, "effectiveTypeValue1", "", null),

    // effectiveType=0 生效结束时间（yyyy-MM-dd）
    // effectiveType=1 有效期 单位是天数 只能是整数的
    EFFECTIVE_TYPE_VALUE2(10012, "effectiveTypeValue2", "", null);

    private int id;
    private String property;
    private String title;
    private String fieldName;

    /**
     * 根据属性名获取枚举，排除生效方式相关属性
     *
     * @param propertyName
     * @return
     */
    public static GoodsPropertyDicEnum getEnumByPropertyExcludeEffective(String propertyName) {
        for (GoodsPropertyDicEnum propertyDicEnum : GoodsPropertyDicEnum.values()) {
            if (propertyDicEnum.getProperty().equals(propertyName)) {
                if (EFFECTIVE_TYPE.equals(propertyDicEnum)
                        || EFFECTIVE_TYPE_VALUE1.equals(propertyDicEnum)
                        || EFFECTIVE_TYPE_VALUE2.equals(propertyDicEnum)) {
                    return null;
                }
                return propertyDicEnum;
            }
        }
        return null;
    }
}
